package com.example.takephoto

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Button
import com.google.android.material.textfield.TextInputEditText
import androidx.appcompat.app.AppCompatActivity

class MainActivity3 : AppCompatActivity() {
    val MainTag = "MainActivity3"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main3)

        val etInput = findViewById<TextInputEditText>(R.id.etInput)

        val btnConfirm = findViewById<Button>(R.id.btnConfirm)

        btnConfirm.setOnClickListener {
            val input = etInput.text.toString()
            val intent = Intent()
            intent.putExtra("input", input)
            setResult(RESULT_OK, intent)
            finish()
        }
        Log.d(MainTag, "onCreate")
    }


    override fun onStart() {
        super.onStart()
        Log.d(MainTag, "onStart")
    }

    override fun onResume() {
        super.onResume()
        Log.d(MainTag, "onResume")
    }

    override fun onPause() {
        super.onPause()
        Log.d(MainTag, "onPause")
    }

    override fun onStop() {
        super.onStop()
        Log.d(MainTag, "onStop")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d(MainTag, "onRestart")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(MainTag, "onDestroy")
    }
}